package main.java.collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo3 {
    public static void main(String[] args) {
        Collection<Point> c = new ArrayList<Point>();
        Point p =  new Point(2,3);
        c.add(p);
        System.out.println(c);
        System.out.println(p); //将P添加到集合中，实际是将p的引用地址装到了集合中

        p.setX(200);
        System.out.println(p); //修改p中的值
        System.out.println(c); //集合中的对象同步修改
    }
}
